home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Various / DevDisk 65 (1989)(DevWare PD).zip / DevDisk 65 (1989)(DevWare PD).adf / prosuite / fileio.h < prev    next >
C/C++ Source or Header  |  1990-07-11  |  7KB  |  234 lines

  1.  
  2. #ifndef FILEIO_H
  3. #define FILEIO_H
  4.  
  5.  
  6. /* *** fileio.h *************************************************************
  7.  *
  8.  * Amiga Programmers' Suite  --  File IO Include File
  9.  *     from Book 1 of the Amiga Programmers' Suite by RJ Mical
  10.  *
  11.  * Copyright (C) 1986, =Robert J. Mical=
  12.  * All Rights Reserved.
  13.  *
  14.  * Created for Amiga developers.
  15.  * Any or all of this code can be used in any program as long as this
  16.  * entire notice is retained, ok?  Thanks.
  17.  *
  18.  * The Amiga Programmer's Suite Book 1 is copyrighted but freely distributable.
  19.  * All copyright notices and all file headers must be retained intact.
  20.  * The Amiga Programmer's Suite Book 1 may be compiled and assembled, and the 
  21.  * resultant object code may be included in any software product.  However, no 
  22.  * portion of the source listings or documentation of the Amiga Programmer's 
  23.  * Suite Book 1 may be distributed or sold for profit or in a for-profit 
  24.  * product without the written authorization of the author, RJ Mical.
  25.  * 
  26.  * HISTORY      NAME            DESCRIPTION
  27.  * -----------  --------------  --------------------------------------------
  28.  * 20 Oct 87    - RJ            Added RENAME_RAMDISK to fix what seems to 
  29.  *                              be a bug in AmigaDOS.
  30.  * 27 Sep 87    RJ              Removed reference to alerts.h, brought 
  31.  *                              declarations into this file
  32.  * 12 Aug 86    RJ >:-{)*       Prepare (clean house) for release
  33.  * 14 Feb 86    =RJ Mical=      Created this file.
  34.  *
  35.  * *********************************************************************** */
  36.  
  37.  
  38. #include <prosuite/prosuite.h>
  39. #include <prosuite/pointers.h>
  40. #include <prosuite/reqsupp.h>
  41.  
  42.  
  43.  
  44. /* === General FileIO Declarations ======================================= */
  45. #define MAX_NAME_LENGTH         64        /* Includes terminating NULL */
  46. #define MAX_TOOLTYPE_LENGTH    80        /* Includes terminating NULL */
  47. #define VISIBLE_SELECT_LENGTH    16        /* Buffer for visible chars + '\0' */
  48.  
  49. /* The WBENCH_CODE definition is used to define whether to include 
  50.  * or not include the Workbench-style .info file pattern matching code.
  51.  * If you intend on using Workbench pattern matching, or if you are 
  52.  * going to give the user the option, define this constant.
  53.  * This makes sure that the Workbench-style code is in included in the 
  54.  * FileIO files when they are compiled.
  55.  * To attempt to match Workbench patterns at run time, you must set 
  56.  * the WBENCH_MATCH flag in your FileIOSupport structure.
  57.  * 
  58.  * If you aren't interested in Workbench-style pattern matching 
  59.  * and are interested in saving about 500 bytes of code size, 
  60.  * comment out the WBENCH_CODE definition.
  61.  */
  62. #define WBENCH_CODE
  63.  
  64.  
  65.  
  66. /* === FileIO Support Structure ========================================== */
  67. struct FileIOSupport
  68.     {
  69.     SHORT Flags;
  70.  
  71.     UBYTE *ReqTitle;    /* The text that will be the requester's title */
  72.  
  73.     /* After a successful call to GetFileIOName(), these fields will have
  74.      * the names selected by the user.  You should never have to initialize
  75.      * these fields, only read from them, though initializing them won't hurt.
  76.      */
  77.     UBYTE FileName[MAX_NAME_LENGTH];
  78.     UBYTE DrawerName[MAX_NAME_LENGTH];
  79.     UBYTE DiskName[MAX_NAME_LENGTH];
  80.  
  81.     /* If the LOCK_GOTTEN flag is set, the lock can be found here. */
  82.     ULONG DOSLock;
  83.  
  84.     SHORT NameCount;
  85.     SHORT NameStart;
  86.     SHORT CurrentPick;
  87.     struct Remember *NameKey;
  88.  
  89.     SHORT VolumeIndex;
  90.     SHORT VolumeCount;
  91.     struct Remember *VolumeKey;
  92.  
  93.     SHORT DiskObjectType;
  94.     UBYTE ToolType[MAX_TOOLTYPE_LENGTH];
  95.  
  96.     LONG UserData;        /* Use this for anything you want */
  97.     };
  98.  
  99.  
  100. /* === User FileIO Flag Definitions === */
  101. #define GOOD_FILENAMES        0x0001  /* Clear this if disk has changed */
  102. #define USE_VOLUME_NAMES    0x0002  /* Use volume rather than device names */
  103. #define DISK_HAS_CHANGED    0x0004  /* Disk changed during GetFileIOName() */
  104. #define DOUBLECLICK_OFF        0x0008  /* Inhibit double-clicking */
  105. #define WBENCH_MATCH        0x0010  /* If set check .info files only */
  106. #define MATCH_OBJECTTYPE    0x0020  /* If set with .info check ObjectType */
  107. #define MATCH_TOOLTYPE        0x0040  /* If set with .info check ToolType */
  108. #define RENAME_RAMDISK        0x0080  /* If set, "RAM DISK:" becomes "RAM:" */
  109.  
  110. /* === System FileIO Flag Definitions === */
  111. #define LOCK_GOTTEN            0x1000    /* Got lock, need to unlock */
  112.  
  113.  
  114.  
  115. /* === Name Table Entry Flags =========================================== */
  116. /* The Name Table Entry consists of the text, null-terminated, followed by 
  117.  * a byte of flag definitions.
  118.  */
  119. /* === Flags Definitions === */
  120. #define NAMED_DIRECTORY    0x01
  121. #define NAMED_PREVIOUS    0x02
  122.  
  123. #define DIR_TEXT_SIZE    3    /* Number of characters for "directory" mark */
  124.  
  125.  
  126.  
  127. /* === OpenRequester ===================================================== */
  128. #define OPENGADGET_CANCEL        0x7FA0
  129. #define OPENGADGET_OK            0x7FA1
  130. #define OPENGADGET_NAMETEXT        0x7FA2
  131. #define OPENGADGET_DRAWERTEXT    0x7FA3
  132. #define OPENGADGET_DISKTEXT        0x7FA4
  133. #define OPENGADGET_SELECTNAME    0x7FA5
  134. #define OPENGADGET_UPGADGET        0x7FA6
  135. #define OPENGADGET_DOWNGADGET    0x7FA7
  136. #define OPENGADGET_PROPGADGET    0x7FA8
  137. #define OPENGADGET_NEXTDISK        0x7FA9
  138. #define OPENGADGET_BACKDROP        0x7FAA
  139.  
  140. #define NAME_ENTRY_COUNT    6    /* These many names in the SelectName box */
  141.  
  142. #define OPEN_NEXTDISK_COUNT    2
  143.  
  144. #define REQTITLE_HEIGHT            8
  145.  
  146. #define OPEN_LEFT                8
  147. #define OPEN_TOP                15
  148. #define OPEN_WIDTH                286
  149. #define OPEN_HEIGHT                (110 + REQTITLE_HEIGHT)
  150. #define OPEN_LINEHEIGHT            10
  151.  
  152. #define OPENSELECT_LEFT            8
  153. #define OPENSELECT_TOP            (15 + REQTITLE_HEIGHT)
  154. #define OPENSELECT_WIDTH        122
  155. #define OPENSELECT_HEIGHT        60
  156.  
  157. #define OPENPROP_MAXHEIGHT        30
  158. #define OPENPROP_TOPHEIGHT        2
  159. #define OPENPROP_BOTTOMHEIGHT    6
  160. #define OPENPROP_MINHEIGHT        8
  161.  
  162.  
  163.  
  164. /* === ALERT Definitions ================================================ */
  165. #define ALERT_ABORT                    0 /* Always zero! */
  166. #define ALERT_NO_MEMORY                1 /* This and next are duplicates ... */
  167. #define ALERT_OUTOFMEM                1 /* ... intentionally because I forget */
  168. #define ALERT_BAD_DIRECTORY            2
  169.  
  170.  
  171.  
  172. /* === Function Declarations (in alphabetical order) ===================== */
  173. UBYTE *AllocMem();
  174. UBYTE *AllocRemember();
  175.  
  176. struct MsgPort *CreatePort();
  177. UBYTE *CurrentVolumeName();
  178.  
  179. BOOL DirectoryName();
  180. BOOL DoubleClick();
  181.  
  182. UBYTE *FindSuffix();
  183. SHORT FriendlyInfoType();
  184.  
  185. struct DiskObject *GetDiskObject();
  186. struct FileIOSupport *GetFileIOSupport();
  187. BOOL GetFileIOName();
  188. struct IntuiMessage *GetMsg();
  189.  
  190. SHORT HandleSelect();
  191.  
  192. SHORT MakeEntry();
  193. BOOL MatchToolValue();
  194. BOOL MessageInterrupt();
  195.  
  196. UBYTE *OpenLibrary();
  197. struct Screen *OpenScreen();
  198. struct Window *OpenWindow();
  199.  
  200. SHORT RemoveGadget();
  201. BOOL Request();
  202.  
  203.  
  204. /* === String Functions === */
  205. SHORT CompareUpperStrings();
  206. VOID ConcatString();
  207. VOID CopyString();
  208.  
  209. UBYTE *FindSuffix();
  210.  
  211. SHORT IndexString();
  212.  
  213. SHORT StringLength();
  214. BOOL StringsEqual();
  215. UBYTE *StripLeadingSpace();
  216. UBYTE *StripOuterSpace();
  217.  
  218.  
  219.  
  220. /* === And Finally, eglobfio inclusion ==================================== */
  221. /* If this is a FileIO source file (as compared with a normal source 
  222.  * from your own program), consider including eglobfio.c.
  223.  */
  224. #ifdef FILEIO_SOURCEFILE
  225. #ifndef EGLOBAL_FILEIO_CANCEL
  226. #include "eglobfio.c"
  227. #endif /* ... end of EGLOBAL_FILEIO_CANCEL conditional */
  228. #endif /* ... end of FILEIO_SOURCEFILE conditional */
  229.  
  230.  
  231.  
  232. #endif /* of FILEIO_H */
  233.  
  234.